<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>float布局</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
        }

        .box {
            width: 600px;
            height: 500px;
            border: 1px solid blue;
            margin: 0 auto;
        }

        .box li {
            float: left;
            width: 190px;
            height: 200px;
            margin: 0px;
            margin-right: 15px;
            margin-bottom: 15px;
        }

        .box li:nth-child(odd) {
            background-color: pink;
        }

        .box li:nth-child(even) {
            background-color: skyblue;
        }

        .box li:nth-child(3n) {
            margin-right: 0;
        }
    </style>
</head>

<body>
    <ul class="box">
        <li>第一个盒子</li>
        <li>第二个盒子</li>
        <li>第三个盒子</li>
        <li>第四个盒子</li>
        <li>第五个盒子</li>
        <li>第六个盒子</li>
    </ul>
</body>

</html>